package com.originskyseed.platform.cms.service;

import java.util.List;
import java.util.Map;

import com.originskyseed.platform.cms.model.Cms;
import com.originskyseed.platform.core.base.BasePage;
import com.originskyseed.platform.user.model.UserInfo;

/**
 * 新闻表Service接口类（OSI_CMS）
 *
 * @author wlj
 */
public interface ICmsService {

	/**
	 * 删除记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(Cms record) throws Exception;

	/**
	 * 批量插入(租户)
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public int insertBatchTenantCode(List<Cms> list, String tenantCode) throws Exception;

	/**
	 * 批量插入
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public int insertBatch(List<Cms> list) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(Cms record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertCmsSelective(Cms record, UserInfo userInfo) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(Cms record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(Cms record) throws Exception;

	/**
	 * 更新排序信息
	 *
	 * @param downCourse
	 * @param upCourse
	 * @return
	 * @throws Exception
	 */
	public int updatePrority(Cms downCourse, Cms upCourse) throws Exception;

	/**
	 * 更新是否置顶
	 *
	 * @param cms
	 * @return
	 * @throws Exception
	 */
	public int updateIsTop(Cms cms) throws Exception;

	/**
	 * 查询最大优先级
	 *
	 * @return
	 * @throws Exception
	 */
	public Integer selectPrority() throws Exception;

	/**
	 * 查询最大优先级
	 *
	 * @return
	 * @throws Exception
	 */
	public Integer selectProrityTenantCode(String tenantCode) throws Exception;

	/**
	 * 根据优先级查询新闻
	 *
	 * @return
	 * @throws Exception
	 */
	public Cms selectCmsByPrority(Integer prority) throws Exception;

	/**
	 * 阅读量统计
	 *
	 * @param cmsId
	 * @return
	 * @throws Exception
	 */
	public int updateVistorCount(String cmsId) throws Exception;

	/**
	 * 批量删除
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteNewsByIds(List<String> ids) throws Exception;

	/**
	 * 新闻下架、发布
	 *
	 * @param ids
	 * @param state
	 * @return
	 * @throws Exception
	 */
	public int updateNewsStateByIds(List<String> ids, int state) throws Exception;

	/**
	 * 通知公告发布后修改为已读状态
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int updateInformStatusByIds(List<String> ids) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Cms selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<Cms> selectList(Cms record) throws Exception;

	/**
	 * 分页查询列表
	 *
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<Cms> selectListByPage(Map<String, Object> params, BasePage<Cms> page) throws Exception;

	/**
	 * 推广平台_新闻类型分页查询
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<Cms> selectListToGeneralizationByPage(Map<String, Object> params, BasePage<Cms> page, UserInfo userInfo) throws Exception;

	/**
	 * 小喇叭分页查询列表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<Cms> selectTrumpetListByPage(Map<String, Object> params, BasePage<Cms> page) throws Exception;

	/**
	 * 开放平台_分页查询
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<Cms> selectListToOpenPlatformByPage(Map<String, Object> params, BasePage<Cms> page) throws Exception;

	/**
	 * 部门下的通知公告
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<Cms> selectDeptNoticeListByPage(Map<String, Object> params, BasePage<Cms> page) throws Exception;

	/**
	 * 部门下的通知公告
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<Cms> selectNoticeListByPage(Map<String, Object> params, BasePage<Cms> page) throws Exception;

	/**
	 * 统计新闻未读
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public Integer countNewsReadObjNum(Map<String, Object> params) throws Exception;

	/**
	 * 统计通知公告未读
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public Integer countCmsReadObjNum(Map<String, Object> params) throws Exception;

}
